﻿/*----------------------------------------------------------------
// Copyright (C) 2011 王冲
// 版权所有。 
//
// 文件名：PersonnelIinformationInfo
// 文件功能描述：人事信息
//
// 
// 创建标识：2012-04-09
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DAO.WaiGaoQiao;

namespace Model.WaiGaoQiao
{
    public class PersonnelIinformationInfo
    {
        public int PID
        {
            get;
            set;
        }
        public string DeptName
        {
            get;
            set;
        }
        public int DEP_ID
        {
            get;
            set;
        }
        public string StructrueName
        {
            get;
            set;
        }
        public string EMPNO
        {
            get;
            set;
        }
        public string PName
        {
            get;
            set;
        }
        public string CARDSTATUS
        {
            get;
            set;
        }
        public string CARDSERIAL
        {
            get;
            set;
        }
        public string PERSONTYPENAME
        {
            get;
            set;
        }
        public string Sex
        {
            get;
            set;
        }
        public string Balance
        {
            get;
            set;
        }
        public string WorkStatus
        {
            get;
            set;
        }
        public string EnrollDate
        {
            get;
            set;
        }
        public string SJLY
        {
            get;
            set;
        }

        private DataAccessPersonnelIinformation dar;
        private int PersonnelIinformationcount;
        public int _PersonnelIinformationcount
        {
            get { return PersonnelIinformationcount; }
        }
        public PersonnelIinformationInfo(bool isgetcount)
        {
            dar = new DataAccessPersonnelIinformation();
            if (isgetcount)
            {
                PersonnelIinformationcount = GetPersonnelIinformationCount();
            }
        }
        public PersonnelIinformationInfo()
        { }
        /// <summary>
        /// 获取人事信息数量
        /// </summary>
        /// <returns></returns>
        public int GetPersonnelIinformationCount()
        {
            return dar.GetPersonnelIinformationCount();
        }

        /// <summary>
        /// 人事信息数量
        /// </summary>
        /// <returns></returns>
        public int GetPersonnelIinformationCount(string where)
        {
            return dar.GetPersonnelIinformationCount(where);
        }

        /// <summary>
        /// 获取部门列表（用于绑定下拉框）
        /// </summary>
        /// <returns></returns>
        public DataSet GetdeptName()
        {
            return dar.GetdeptName();
        }


        /// <summary>
        /// 获取岗位列表（用于绑定下拉框）
        /// </summary>
        /// <returns></returns>
        public DataSet GetStructrueName()
        {
            return dar.GetStructrueName();
        }

        /// <summary>
        /// 获取人事信息表
        /// </summary>
        /// <returns></returns>
        public IList<PersonnelIinformationInfo> SelPersonnelIinformationInfo(int pagesize, int startindex, string strquery)
        {
            IList<PersonnelIinformationInfo> perlist = new List<PersonnelIinformationInfo>();
            PersonnelIinformationInfo perinfo;
            DataSet ds = dar.SelPersonnelIinformationInfo(pagesize, startindex, strquery);
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                perinfo = new PersonnelIinformationInfo()
                {
                    PID = Convert.ToInt32(item["PID"]),
                    DeptName = item["DeptName"].ToString(),
                    StructrueName = item["岗位名称"].ToString(),
                    EMPNO = item["EMPNO"].ToString(),
                    PName = item["PName"].ToString(),
                    CARDSTATUS = item["卡状态"].ToString(),
                    CARDSERIAL = item["卡序列号"].ToString(),
                    PERSONTYPENAME = item["PersonTypeName"].ToString(),
                    Sex = item["性别"].ToString(),
                    Balance = item["卡内余额"].ToString(),
                    WorkStatus = item["工作状态"].ToString(),
                    EnrollDate = item["入职日期"].ToString(),
                    SJLY = item["数据来源"].ToString()
                };
                perlist.Add(perinfo);
            }
            return perlist;
        }

        /// <summary>
        /// 获取人事信息表
        /// </summary>
        /// <returns></returns>
        public DataSet SelPersonnelIinformationInfoAll(string strquery)
        {
            IList<PersonnelIinformationInfo> perlist = new List<PersonnelIinformationInfo>();
            DataSet ds = dar.SelPersonnelIinformationInfoAll(strquery);
            return ds;
        }
    }
}
